<template>
  <div class="app-container yzh-business">
    <avue-form
      v-if="formData.id"
      :option="formOption"
      v-model="formData"
      ref="formRef"
    >
      <!-- <template #cyhscb-label="{ column }">
        <span class="leading-snug">{{ column.label }}</span>
      </template> -->
      <!-- <template #menu-form="{ size }">
        <el-button
          icon="Search"
          type="primary"
          :size="size"
          @click="handleSubmit"
          >提交</el-button
        >
        <el-button icon="Refresh" :size="size" @click="handleReset(form)"
          >重置</el-button
        >
      </template> -->
    </avue-form>
  </div>
</template>
<script setup name="Business">
import { reactive, toRefs, ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
const { proxy } = getCurrentInstance()
const {
  ord_product_plate_type,
  ord_product_plate,
  yes_or_no,
  measurement_unit,
  credit_rating,
  quantity_accuracy,
  addition_method,
  device_type,
  warehouse_info,
  self_product,
  product_bussiness_plate,
  transaction_type
} = proxy.useDict(
  'ord_product_plate_type',
  'ord_product_plate',
  'yes_or_no',
  'measurement_unit',
  'credit_rating',
  'quantity_accuracy',
  'addition_method',
  'device_type',
  'warehouse_info',
  'self_product',
  'product_bussiness_plate',
  'transaction_type'
)

const props = defineProps({
  productData: {
    type: Object,
    require: true
  }
})
const data = reactive({
  formOption: {
    tabs: false,
    submitBtn: false,
    emptyBtn: false,
    disabled: true,
    labelWidth: '140',
    column: [
      {
        label: '参考成本',
        prop: 'referencePrice',
        span: 12,
        placeholder: '参考成本',
        type: 'input',
        rules: [
          {
            required: false,
            message: '请输入参考成本',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '收入分摊',
        prop: 'incomeShare',
        type: 'radio',
        dicData: yes_or_no
      },
      {
        label: '开票名称',
        prop: 'invoiceName',
        span: 12,
        placeholder: '开票名称',
        type: 'input',
        rules: [
          {
            required: false,
            message: '请输入开票名称',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '批次核算',
        prop: 'batchAccounting',
        type: 'radio',
        dicData: yes_or_no
      },
      {
        label: '开票规格型号',
        prop: 'invoiceType',
        span: 12,
        placeholder: '开票规格型号',
        type: 'input',
        rules: [
          {
            required: false,
            message: '请输入开票规格型号',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '项目核算',
        prop: 'projectAccounting',
        type: 'radio',
        dicData: yes_or_no
      },
      {
        label: '计量单位',
        // labelWidth: '0',
        span: 12,
        prop: 'unit',
        placeholder: '计量单位',
        type: 'select',
        dicData: measurement_unit
      },
      {
        label: '内部交易',
        prop: 'internalTransaction',
        type: 'radio',
        dicData: yes_or_no
      },
      {
        label: '入库单价为0时，参与成本核算',
        prop: 'costAccounting',
        type: 'radio',
        labelWidth: '120',
        dicData: yes_or_no
      }
    ]
  },
  formData: {}
})
let { formOption, formData } = toRefs(data)
function init() {
  formData.value = props.productData
}
init()
</script>
<style lang="scss" scoped></style>
